LanguageExt.Core

LanguageExt.Core Monads Pure and Fail

Contents

record Fail <E> (E Value) Source #

Represents an error value.

On its own this doesn't do much, but allows other monads to convert from it and provide binding extensions that mean it can be lifted into other monads without specifying lots of extra generic arguments.

Parameters

type E

Bound value type

param Value

Bound value

Methods

method Fail<F> MapFail <F> (Func<E, F> f) Source #

method Either<E, A> ToEither <A> () Source #

method Transducer<Unit, E> ToTransducer () Source #

method Reducer<Unit, S> Transform <S> (Reducer<E, S> reduce) Source #

method string ToString () Source #

method Either<E, C> SelectMany <B, C> (Func<Unit, Pure<B>> bind, Func<Unit, B, C> project) Source #

method Either<E, C> SelectMany <B, C> (Func<Unit, Option<B>> bind, Func<Unit, B, C> project) Source #

class FailExtensions Source #

Methods

method Fin<A> ToFin <A> (this Fail<Error> fail) Source #

method Validation<F, A> ToValidation <F, A> (this Fail<F> fail) Source #

where F : Monoid<F>

method Eff<RT, A> ToEff <RT, A> (this Fail<Error> fail) Source #

method Eff<A> ToEff <A> (this Fail<Error> fail) Source #

record Pure <A> (A Value) Source #

Represents a pure value. Usually understood to be the 'success' value.

On its own this doesn't do much, but allows other monads to convert from it and provide binding extensions that mean it can be lifted into other monads without specifying lots of extra generic arguments.

Parameters

type A

Bound value type

param Value

Bound value

Properties

property Transducer<Unit, A> Morphism Source #

Methods

method Pure<B> Map <B> (Func<A, B> f) Source #

Functor map

Parameters

type B

Result bound value type

param f

Mapping function

returns

Result of the applying the mapping function to the Pure value

method Pure<B> Bind <B> (Func<A, Pure<B>> f) Source #

Monadic bind

Parameters

type B

Result bound value type

param f

Bind function

returns

Result of the applying the bind function to the Pure value

method Either<L, A> Bind <L> (Func<A, Fail<L>> f) Source #

Monadic bind

Parameters

type L

Result bound value type

param f

Bind function

returns

Result of the applying the bind function to the Pure value

method IO<B> Bind <B> (Func<A, IO<B>> f) Source #

Monadic bind

Parameters

type B

Result bound value type

param f

Bind function

returns

Result of the applying the bind function to the Pure value

method Pure<C> SelectMany <B, C> (Func<A, Pure<B>> bind, Func<A, B, C> project) Source #

Monadic bind and project

Parameters

type B

Result of the bind operation bound value type

type C

Result of the mapping operation bound value type

param bind

Bind function

param project

Project function

returns

Result of the applying the bind and mapping function to the Pure value

method Either<L, C> SelectMany <L, C> (Func<A, Fail<L>> bind, Func<A, Unit, C> project) Source #

Monadic bind and project

Parameters

type L

Result of the bind operation bound value type

type C

Result of the mapping operation bound value type

param bind

Bind function

param project

Project function

returns

Result of the applying the bind and mapping function to the Pure value

method IO<C> SelectMany <B, C> (Func<A, IO<B>> bind, Func<A, B, C> project) Source #

Monadic bind and project

Parameters

type B

Result of the bind operation bound value type

type C

Result of the mapping operation bound value type

param bind

Bind function

param project

Project function

returns

Result of the applying the bind and mapping function to the Pure value

method Transducer<E, C> SelectMany <E, B, C> (Func<A, Transducer<E, B>> bind, Func<A, B, C> project) Source #

Monadic bind and project

Parameters

type B

Result of the bind operation bound value type

type C

Result of the mapping operation bound value type

param bind

Bind function

param project

Project function

returns

Result of the applying the bind and mapping function to the Pure value

method Option<A> ToOption () Source #

method Either<L, A> ToEither <L> () Source #

method Fin<A> ToFin () Source #

method IO<A> ToIO () Source #

method Eff<RT, A> ToEff <RT> () Source #

method Eff<A> ToEff () Source #

method Either<L, B> Bind <L, B> (Func<A, Either<L, B>> bind) Source #

method Fin<B> Bind <B> (Func<A, Fin<B>> bind) Source #

method Eff<RT, B> Bind <RT, B> (Func<A, Eff<RT, B>> bind) Source #

method Eff<B> Bind <B> (Func<A, Eff<B>> bind) Source #

method K<M, B> Bind <M, B> (Func<A, K<M, B>> bind) Source #

where M : Monad<M>

method Reader<Env, B> Bind <Env, B> (Func<A, Reader<Env, B>> bind) Source #

method ReaderT<Env, M, B> Bind <Env, M, B> (Func<A, ReaderT<Env, M, B>> bind) Source #

where M : Monad<M>, SemiAlternative<M>

method State<S, B> Bind <S, B> (Func<A, State<S, B>> bind) Source #

method StateT<S, M, B> Bind <S, M, B> (Func<A, StateT<S, M, B>> bind) Source #

where M : Monad<M>, SemiAlternative<M>

method ResourceT<M, B> Bind <M, B> (Func<A, ResourceT<M, B>> bind) Source #

where M : Monad<M>, SemiAlternative<M>

method OptionT<M, B> Bind <M, B> (Func<A, OptionT<M, B>> bind) Source #

where M : Monad<M>

method Option<B> Bind <B> (Func<A, Option<B>> bind) Source #

method Either<L, C> SelectMany <L, B, C> (Func<A, Either<L, B>> bind, Func<A, B, C> project) Source #

method Fin<C> SelectMany <B, C> (Func<A, Fin<B>> bind, Func<A, B, C> project) Source #

method Eff<RT, C> SelectMany <RT, B, C> (Func<A, Eff<RT, B>> bind, Func<A, B, C> project) Source #

method Eff<C> SelectMany <B, C> (Func<A, Eff<B>> bind, Func<A, B, C> project) Source #

method K<M, C> SelectMany <M, B, C> (Func<A, K<M, B>> bind, Func<A, B, C> project) Source #

where M : Monad<M>

method Reader<Env, C> SelectMany <Env, B, C> (Func<A, Reader<Env, B>> bind, Func<A, B, C> project) Source #

method Reader<Env, C> SelectMany <Env, M, B, C> (Func<A, K<Reader<Env>, B>> bind, Func<A, B, C> project) Source #

method ReaderT<Env, M, C> SelectMany <Env, M, B, C> (Func<A, ReaderT<Env, M, B>> bind, Func<A, B, C> project) Source #

where M : Monad<M>, SemiAlternative<M>

method ReaderT<Env, M, C> SelectMany <Env, M, B, C> (Func<A, K<ReaderT<Env, M>, B>> bind, Func<A, B, C> project) Source #

where M : Monad<M>, SemiAlternative<M>

method State<S, C> SelectMany <S, B, C> (Func<A, State<S, B>> bind, Func<A, B, C> project) Source #

method State<S, C> SelectMany <S, B, C> (Func<A, K<State<S>, B>> bind, Func<A, B, C> project) Source #

method StateT<S, M, C> SelectMany <S, M, B, C> (Func<A, StateT<S, M, B>> bind, Func<A, B, C> project) Source #

where M : Monad<M>, SemiAlternative<M>

method StateT<S, M, C> SelectMany <S, M, B, C> (Func<A, K<StateT<S, M>, B>> bind, Func<A, B, C> project) Source #

where M : Monad<M>, SemiAlternative<M>

method ResourceT<M, C> SelectMany <M, B, C> (Func<A, ResourceT<M, B>> bind, Func<A, B, C> project) Source #

where M : Monad<M>, SemiAlternative<M>

method ResourceT<M, C> SelectMany <M, B, C> (Func<A, K<ResourceT<M>, B>> bind, Func<A, B, C> project) Source #

where M : Monad<M>, SemiAlternative<M>

method OptionT<M, C> SelectMany <M, B, C> (Func<A, OptionT<M, B>> bind, Func<A, B, C> project) Source #

where M : Monad<M>

method OptionT<M, C> SelectMany <M, B, C> (Func<A, K<OptionT<M>, B>> bind, Func<A, B, C> project) Source #

where M : Monad<M>

method Option<C> SelectMany <B, C> (Func<A, Option<B>> bind, Func<A, B, C> project) Source #

method Reducer<Unit, S> Transform <S> (Reducer<A, S> reduce) Source #

method string ToString () Source #

class PureExtensions Source #

Methods

method Pure<A> Flatten <A> (this Pure<Pure<A>> mma) Source #

Monadic join

Parameters

type A

Bound value type

param mma

Nested Pure monad

returns

Flattened monad

method Validation<F, B> Bind <F, A, B> (this Pure<A> ma, Func<A, Validation<F, B>> bind) Source #

where F : Monoid<F>

method Validation<F, A> ToValidation <F, A> (this Pure<A> ma) Source #

where F : Monoid<F>

method Validation<F, C> SelectMany <F, A, B, C> ( this Pure<A> ma, Func<A, Validation<F, B>> bind, Func<A, B, C> project) Source #

where F : Monoid<F>